<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserAuthSpiderTransLogsTable extends Migration
{
    const TABLE_NAME = 'user_auth_spider_trans_logs';
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create(self::TABLE_NAME, function (Blueprint $table) {
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->increments('id');
            $table->integer('loan_request_id')->comment('授信申请表ID');
            $table->integer('user_id')->comment('用户id');
            $table->string('phone_trade_no')->default('')->comment('运营商trade编号');
            $table->tinyInteger('phone_status')->default(1)->comment('运营商爬虫状态 1=原始状态 2=成功 3=失败');
            $table->string('zhima_trade_no')->default('')->comment('芝麻信用trade编号');
            $table->tinyInteger('zhima_status')->default(1)->comment('芝麻信用爬虫状态 1=原始状态 2=成功 3=失败');
            $table->string('phone_failed_reason')->default('')->comment('运营商失败原因');
            $table->string('zhima_failed_reason')->default('')->comment('芝麻信用失败原因');
            $table->timestamps();
        });
        \DB::statement('ALTER TABLE `'. self::TABLE_NAME.'`CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
        \DB::statement('ALTER TABLE `'. self::TABLE_NAME.'`COMMENT="爬虫流水号信息表";');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists(self::TABLE_NAME);
    }
}
